package com.balakitbbs.controller;

import org.springframework.beans.factory.annotation.Autowired; 
import java.util.*;               
import org.springframework.stereotype.Controller;               
import org.springframework.web.bind.annotation.PathVariable;               
import org.springframework.web.bind.annotation.RequestMapping;               
import org.springframework.web.servlet.ModelAndView;               
import com.balakitbbs.page.Page;               
import com.balakitbbs.page.SearchPageUtil;               
import com.balakitbbs.service.Bala_sysconfigService;
import com.balakitbbs.entity.Bala_sysconfig;
   /**
    * bala_sysconfig Controller类
    */ 
@Controller
public class Bala_sysconfigController{
	@Autowired
	private Bala_sysconfigService bala_sysconfigservice;

//增加系统配置表
@RequestMapping("/page/{pageIndex}/{pageSize}/addBala_sysconfig")
public String addBala_sysconfig(Bala_sysconfig bala_sysconfig,@PathVariable Integer pageIndex,@PathVariable Integer pageSize){
	bala_sysconfig.setCdate(new Date());
	bala_sysconfig.setId(UUID.randomUUID().toString());
	bala_sysconfigservice.addBala_sysconfig(bala_sysconfig);
	return "redirect:/page/"+pageIndex+"/"+pageSize+"/selectBala_sysconfig.do";
}


//删除系统配置表
@RequestMapping("/page/{Id}/{pageIndex}/{pageSize}/delBala_sysconfig")
public String delBala_sysconfig(@PathVariable String Id,@PathVariable Integer pageIndex,@PathVariable Integer pageSize){
	bala_sysconfigservice.delBala_sysconfig(Id);
	return "redirect:/page/"+pageIndex+"/"+pageSize+"/selectBala_sysconfig.do";
}


//修改系统配置表
@RequestMapping("/page/{pageIndex}/{pageSize}/updateBala_sysconfig")
public String updateBala_sysconfig(Bala_sysconfig bala_sysconfig,@PathVariable Integer pageIndex,@PathVariable Integer pageSize){
	bala_sysconfig.setUdate(new Date());
	bala_sysconfigservice.updateBala_sysconfig(bala_sysconfig);
	return "redirect:/page/"+pageIndex+"/"+pageSize+"/selectBala_sysconfig.do";
}


//查询系统配置表
@RequestMapping("/page/{pageIndex}/{pageSize}/selectBala_sysconfig")
public ModelAndView selectBala_sysconfigs(Bala_sysconfig bala_sysconfig,@PathVariable Integer pageIndex,@PathVariable Integer pageSize){
	ModelAndView modelAndView = new ModelAndView();
	int selectBala_sysconfigCount = bala_sysconfigservice.selectBala_sysconfigsByPOJOCount(bala_sysconfig);
	Page page = new Page(pageIndex, pageSize, selectBala_sysconfigCount);
	SearchPageUtil spu = new SearchPageUtil();
	spu.setPage(page);
	modelAndView.addObject("data", bala_sysconfigservice.selectBala_sysconfigsByPojoPage(spu, bala_sysconfig));
	modelAndView.addObject("page", page);
	modelAndView.addObject("s", 1);
	modelAndView.addObject("po", new Bala_sysconfig());
	modelAndView.setViewName("/WEB-INF/page/bala_sysconfig.jsp");
	return modelAndView;
}

}

